<?php

namespace App\HttpController\Admin;

use App\Logic\Product\ProductService;

/**
 * 商品
 */
class Product extends BaseController {
    /**列表*/
    public function index()
    {
        $service = new ProductService();
        $result = $service->getLists($this->request());
        return $this->writeJsonByOutput($result);
    }
    /**字典*/
    public function dict()
    {
        $service = new ProductService();
        $result = $service->getDict($this->request());
        return $this->writeJsonByOutput($result);
    }
    /**创建*/
    public function create()
    {
        $service = new ProductService();
        $data = $this->getJson();
        $result = $service->create($data);
        return $this->writeJsonByOutput($result);
    }
    /**删除*/
    public function delete()
    {
        $service = new ProductService();
        $selected = $this->getJson('selected');
        $result = $service->deleteRecord($selected);
        return $this->writeJsonByOutput($result);
    }
}
